IPv6 is a next-generation Internet technology. The length of an IPv6 address is 128 bits. As specified by the Internet Engineering Task Force IETF, a maximum of the first 64 bits of an IPv6 address may be used as a subnet prefix identifier. When a router forwards an IPv6 data packet, the router selects a forwarding path according to the first 64 bits. The last 64 bits of the IPv6 address is a host identifier, where the host identifier is used to identify a host using the address.
An IPv6 address is normally written in hexadecimal groups of 16 bits. Every two groups are separated by “:” and a specific format is as follows: 1234:5678:90ab:0000:0000:0000:0000:cdef. Several zeros in the format may be omitted and an abbreviated form is 1234:5678:90ab::cdef. An expression of an IP address prefix thereof is 1234:5678:90ab::/48, indicating that the subnet prefix has 48 bits.
In a data communication process, an IP address plays a role in communication routing and in identifying hosts. For example, in various attacks in the current Internet, data communication on a lower layer is performed mainly by spoofing an IP address to avoid being tracked down. It is necessary to query IP addresses in real time. There are about 4.3 billion IPv4 addresses; however, the number of IPv6 addresses is much bigger, which is about 3.4×1038. It is much more difficult to query IPv6 addresses than IPv4 addresses.
At present, IPv4 address information query is mainly based on IP address databases stored by operators. In a process of implementing the present invention, the inventors find that the prior art has at least the following problem: the IP address databases stored by the operators are static data, which cannot feed back in a timely manner the latest situation fed back by an IP address. Therefore, the IP address query method of the prior art cannot implement real-time query.